# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-msoffcrypto-tool
pkgver=5.0.0
pkgrel=1
pkgdesc="tool and library for decrypting MS Office files with passwords or other keys"
url="https://github.com/nolze/msoffcrypto-tool"
arch="noarch"
license="MIT"
depends="python3 py3-cryptography py3-olefile py3-setuptools"
makedepends="py3-build py3-installer py3-poetry-core"
checkdepends="bash py3-pytest"
source="$pkgname-$pkgver.tar.gz::https://github.com/nolze/msoffcrypto-tool/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/msoffcrypto-tool-$pkgver"

build() {
	# XXX: hack to make poetry not ignore files
	GIT_DIR=. python3 -m build --no-isolation --wheel
}

check() {
	python3 -m installer -d testenv \
		dist/msoffcrypto_tool-$pkgver-py3-none-any.whl
	local sitedir="$(python3 -c 'import site;print(site.getsitepackages()[0])')"
	PATH="$PWD/testenv/usr/bin:$PATH" PYTHONPATH="$PWD/testenv/$sitedir" python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/msoffcrypto_tool-$pkgver-py3-none-any.whl
}

sha512sums="
e2c03384d6447146ef0790da9d40c070e5fe9af3d2273ed1eb6410025146db7917df0f5704a8f6734b4f372da59e3f84ad3b1262715ca9f3b5b87c8dc4ad9847  py3-msoffcrypto-tool-5.0.0.tar.gz
"
